/**
 * 
 */
package rer.controller;

import java.io.Serializable;
import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

import org.primefaces.model.chart.BarChartModel;
import org.primefaces.model.chart.ChartSeries;

import rer.model.Relatorio;
import rer.persistencia.RelatoriosDAO;

/**
 * Programa que
 * 
 * @author José C M Rodrigues
 * @since 23/11/2014
 * @version 1.0
 */
@Named("relatoriosBean")
@RequestScoped
public class RelatorioBean implements Serializable{

	private static final long serialVersionUID = 4907915545387819492L;
	private Relatorio relatorio;
	private RelatoriosDAO relatoriosDAO;
	
	public RelatorioBean(){
		relatorio = new Relatorio();
		relatoriosDAO = new RelatoriosDAO();
	}
	
	
	
	public double alunosMes(){
		
		double resultado = 0;
		
		try{
			resultado = relatoriosDAO.mediaMat();
		}catch(Exception erro){
			System.out.println(erro.getMessage());
		}
		
		return resultado;
	}
	
		
	public List<Relatorio> sazonalidade(){
		return relatoriosDAO.sazonalidadeMat();
	}
	
	
	public List<Relatorio> matriculasPlano(){
		return relatoriosDAO.matriculasPlano();
	}
	

	public int totalMatriculas(){
		return relatoriosDAO.totalMatriculas();
	}
	
	
	public List<Relatorio> matriculasAno(){
		return relatoriosDAO.matriculasAno("A");
	}
	
	public List<Relatorio> desistenciasAno(){
		return relatoriosDAO.matriculasAno("D");
	}
		
	public Double gastoMesAtual(){
		return relatoriosDAO.totalGastoMensal();
	}

	public List<Relatorio> gastosAnuaisContas(){
		return relatoriosDAO.totalAnualContas();
	}

	public List<Relatorio> matriculaAluno() {
		return relatoriosDAO.matriculaAluno(ultimoAlunoMat());
	}
	
	public List<Relatorio> respAluno() {
		return relatoriosDAO.responsaveisAluno(ultimoAlunoMat());
	}

	public List<Relatorio> servicosAluno() {
		return relatoriosDAO.servicosAluno(ultimoAlunoMat());
	}
	
	public int ultimoAlunoMat(){
		return relatoriosDAO.ultimoAlunoMatriculado();
	}
	
	public int ultimaMatAtiva(){
		return relatoriosDAO.ultimaMatriculaAtiva();
	}
	
	public Double totalServicos(){
		return relatoriosDAO.totalServicos(ultimaMatAtiva());
	}
	
	
}
